package com.wx.nbregisterserver.heartbeat;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;


/**
 * 用于监测连接是否可用
 */
@Component
public class HttpHeartBeatStatus {


    public boolean getSeverStatus(String ip,int port){

        Socket socket = new Socket();
        try {
            socket.connect(new InetSocketAddress(ip,port),1000);
            return true;
        } catch (IOException e) {
            return false;
        }



    }

}
